package cn.kgc.service.impl;

import cn.kgc.bean.pojo.CDepartment;
import cn.kgc.mapper.DepartmentManagerMapper;
import cn.kgc.service.DepartmentManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentManagerServiceImpl implements DepartmentManagerService {
    @Autowired
    private DepartmentManagerMapper dmm;

    @Override
    public List<CDepartment> selectAll() {
        return dmm.selectAll();
    }

    @Override
    public boolean addDepartment(CDepartment cDepartment) {
        if (dmm.addDepartment(cDepartment) > 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteDepartmentById(long id) {
        if (dmm.deleteDepartmentById(id) > 0 ){
            return true;
        }
        return false;
    }

    @Override
    public CDepartment selectAllById(long id) {
        return dmm.selectAllById(id);
    }

    @Override
    public boolean updateDepartment(CDepartment cDepartment) {
        if (dmm.updateDepartment(cDepartment) > 0){
            return true;
        }
        return false;
    }

    @Override
    public List<CDepartment> selectByName(String name) {
        return dmm.selectByName(name);
    }
}
